//
//  gastos.h
//  prototipoEcoFriends
//
//  Created by mayraDonaji on 9/20/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreData/CoreData.h>


@interface gastos : UIViewController <UITextFieldDelegate, NSFetchedResultsControllerDelegate>{
	
	// CoreData attributes
	NSFetchedResultsController *fetchedResultsController;
	NSManagedObjectContext *managedObjectContext;

	UITextField * gastoEnGas, *gastoEnLuz, *gastoEnAgua, *totalGasto;
	UIButton * irAConfDeMisG;
	UIButton * irAMainDeMisG;
	UIButton * nextMonthBt;
	UIButton * prevMonthBt;
	
	// Months
	NSArray *meses;
	UITextField *month;
	UITextField *year;
	int currentMonth;
	int currentYear;
	int maxMonth;
	int maxYear;
	
}

// CoreData Properties
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;

// UI
@property (nonatomic, retain) IBOutlet UITextField * gastoEnGas;
@property (nonatomic, retain) IBOutlet UITextField * gastoEnLuz;
@property (nonatomic, retain) IBOutlet UITextField * gastoEnAgua;
@property (nonatomic, retain) IBOutlet UITextField * totalGasto;


@property (nonatomic, retain) IBOutlet UIButton * irAMainDeMisG;
@property (nonatomic, retain) IBOutlet UIButton * irAConfDeMisG;

// Months
@property (copy) NSArray *meses;
@property (nonatomic, retain) IBOutlet UITextField *month;
@property (nonatomic, retain) IBOutlet UITextField *year;
@property (nonatomic, retain) IBOutlet UIButton *nextMonthBt;
@property (nonatomic, retain) IBOutlet UIButton *prevMonthBt;

-(IBAction) nextMonth:(id)sender;
-(IBAction) prevMonth:(id)sender;

// Navigation
-(IBAction) irAMainDeMisG:(id)sender;
-(IBAction) irAConfDeMisG:(id)sender;

// Methods to hide the keyboard
-(BOOL) textFieldShouldReturn: (UITextField *)textField;
-(void) dismissKeyboard;
-(IBAction) backgroundTouched:(id)sender;

// Methods for expenses
-(void) calculateExpenses;

// Methods for ABC expenses
-(void) addGasto;
-(void) displayCurrentData;

@end
